﻿using System.ComponentModel.DataAnnotations;
namespace T4ViewModel.Test
{
    public class Configuration : ViewModelsConfiguration
    {
        public override void Configure(ViewModelSetupCollection configuration)
        {
            configuration.SetNamespace("T4ViewModel.Test.ViewModels");

            configuration.For<BlogPostModel>("PersonPostViewModel")
                .IncludeAllProperties()
                .ExcludeProperty(p => p.Comments)
                .AddProperty<string>("PersonName");

            configuration.For<PersonModel>("PersonNameViewModel")
                .IncludeProperty(p => p.FirstName)
                .IncludeProperty(p => p.LastName);

            configuration.For<CommentModel>("CommentViewModel")
                .IncludeAllProperties()
                .AddProperty<bool>("Rating", () => new RangeAttribute(0, 5) { ErrorMessage = "Rating cannot be greater than 5" });
        }
    }
}
